Skip to content

Fix Total Org Summary hours to match Leaderboard - #2335

Open
akv-iu wants to merge 3 commits into
developmentfrom
agent/pr2066-total-hours-followup
Open

Fix Total Org Summary hours to match Leaderboard#2335
akv-iu wants to merge 3 commits into
developmentfrom
agent/pr2066-total-hours-followup

Conversation

@akv-iu

@akv-iu akv-iu commented Sep 6, 2026

Copy link
Copy Markdown
image

Description

Priority High follow-up to PR #2066.

The Total Hours Worked value in Reports → Total Org Summary did not match the Total Time shown on the Dashboard Leaderboard for the same current-week date range. PR #2066 aligned the report with the Dashboard organization-summary aggregation rather than the Leaderboard aggregation, so the mismatch remained.

The calculations used different inclusion rules:

  • Total Org Summary excluded active mentors and active users with zero committed hours.
  • Total Org Summary excluded person, team, and project entry types that the Leaderboard includes.
  • Total Org Summary included inactive time entries that the Leaderboard excludes.

This change aligns Total Org Summary with the Leaderboard while preserving the report's selected date range.

Fixes the Priority High follow-up defect reported against #2066.

Related PRS (if any):

  1. This is a backend follow-up to PR Sohail: Total Hours Worked Not Matching Leaderboard #2066.
  2. No frontend PR is required. Test with the development frontend branch or the deployed frontend against this backend branch.

Main changes explained:

  1. Update src/helpers/overviewReportHelper.js so getTotalHoursWorked includes every active user, matching the Leaderboard.
  2. Include all active time-entry types and exclude entries where isActive is false, matching the Leaderboard query.
  3. Preserve the selected inclusive report date range instead of hardcoding the current week.
  4. Add a focused regression test that verifies the Leaderboard inclusion rules and returned total.

How to test:

  1. Check out agent/pr2066-total-hours-followup in HGNRest.
  2. Run npm install, then run the backend with npm start.
  3. Run the frontend from its development branch and clear site data/cache.
  4. Log in as an Owner.
  5. Go to Dashboard → Leaderboard, select Show all, and note the worked-hours value in the totals row under Total Time (the value before “of”).
  6. Go to Reports → Total Org Summary and select the same current-week date range used by the Leaderboard.
  7. Verify Total Hours Worked equals the Leaderboard worked-hours total after applying the same rounding precision.
  8. Run npx jest src/helpers/overviewReportHelper.spec.js --runInBand --forceExit and verify all tests pass.

Screenshots or videos of changes:

Not applicable. This is a backend aggregation fix with no UI changes.

Note:

  • The API response shape is unchanged: totalHoursWorked.current remains the reported value.
  • No dependency, schema, route, or frontend changes are included.
  • Validation completed: 8 focused Jest tests passed, staged-file checks passed, and ESLint reported zero errors.

@sonarqubecloud

sonarqubecloud Bot commented Sep 6, 2026

Copy link
Copy Markdown

@akv-iu
akv-iu marked this pull request as ready for review September 6, 2026 02:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant